<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
class PHPExcel_Shared_Font
{
    public static $defaultColumnWidths = ["Arial" => ["1" => ["px" => 24, "width" => 12], "2" => ["px" => 24, "width" => 12], "3" => ["px" => 32, "width" => 10.6640625], "4" => ["px" => 32, "width" => 10.6640625], "5" => ["px" => 40, "width" => 10], "6" => ["px" => 48, "width" => 9.59765625], "7" => ["px" => 48, "width" => 9.59765625], "8" => ["px" => 56, "width" => 9.33203125], "9" => ["px" => 64, "width" => 9.140625], "10" => ["px" => 64, "width" => 9.140625]], "Calibri" => ["1" => ["px" => 24, "width" => 12], "2" => ["px" => 24, "width" => 12], "3" => ["px" => 32, "width" => 10.6640625], "4" => ["px" => 32, "width" => 10.6640625], "5" => ["px" => 40, "width" => 10], "6" => ["px" => 48, "width" => 9.59765625], "7" => ["px" => 48, "width" => 9.59765625], "8" => ["px" => 56, "width" => 9.33203125], "9" => ["px" => 56, "width" => 9.33203125], "10" => ["px" => 64, "width" => 9.140625], "11" => ["px" => 64, "width" => 9.140625]], "Verdana" => ["1" => ["px" => 24, "width" => 12], "2" => ["px" => 24, "width" => 12], "3" => ["px" => 32, "width" => 10.6640625], "4" => ["px" => 32, "width" => 10.6640625], "5" => ["px" => 40, "width" => 10], "6" => ["px" => 48, "width" => 9.59765625], "7" => ["px" => 48, "width" => 9.59765625], "8" => ["px" => 64, "width" => 9.140625], "9" => ["px" => 72, "width" => 9], "10" => ["px" => 72, "width" => 9]]];
    private static $autoSizeMethods = ["approx", "exact"];
    private static $autoSizeMethod = "approx";
    private static $trueTypeFontPath;
    const AUTOSIZE_METHOD_APPROX = "approx";
    const AUTOSIZE_METHOD_EXACT = "exact";
    const CHARSET_ANSI_LATIN = 0;
    const CHARSET_SYSTEM_DEFAULT = 1;
    const CHARSET_SYMBOL = 2;
    const CHARSET_APPLE_ROMAN = 77;
    const CHARSET_ANSI_JAPANESE_SHIFTJIS = 128;
    const CHARSET_ANSI_KOREAN_HANGUL = 129;
    const CHARSET_ANSI_KOREAN_JOHAB = 130;
    const CHARSET_ANSI_CHINESE_SIMIPLIFIED = 134;
    const CHARSET_ANSI_CHINESE_TRADITIONAL = 136;
    const CHARSET_ANSI_GREEK = 161;
    const CHARSET_ANSI_TURKISH = 162;
    const CHARSET_ANSI_VIETNAMESE = 163;
    const CHARSET_ANSI_HEBREW = 177;
    const CHARSET_ANSI_ARABIC = 178;
    const CHARSET_ANSI_BALTIC = 186;
    const CHARSET_ANSI_CYRILLIC = 204;
    const CHARSET_ANSI_THAI = 221;
    const CHARSET_ANSI_LATIN_II = 238;
    const CHARSET_OEM_LATIN_I = 255;
    const ARIAL = "arial.ttf";
    const ARIAL_BOLD = "arialbd.ttf";
    const ARIAL_ITALIC = "ariali.ttf";
    const ARIAL_BOLD_ITALIC = "arialbi.ttf";
    const CALIBRI = "CALIBRI.TTF";
    const CALIBRI_BOLD = "CALIBRIB.TTF";
    const CALIBRI_ITALIC = "CALIBRII.TTF";
    const CALIBRI_BOLD_ITALIC = "CALIBRIZ.TTF";
    const COMIC_SANS_MS = "comic.ttf";
    const COMIC_SANS_MS_BOLD = "comicbd.ttf";
    const COURIER_NEW = "cour.ttf";
    const COURIER_NEW_BOLD = "courbd.ttf";
    const COURIER_NEW_ITALIC = "couri.ttf";
    const COURIER_NEW_BOLD_ITALIC = "courbi.ttf";
    const GEORGIA = "georgia.ttf";
    const GEORGIA_BOLD = "georgiab.ttf";
    const GEORGIA_ITALIC = "georgiai.ttf";
    const GEORGIA_BOLD_ITALIC = "georgiaz.ttf";
    const IMPACT = "impact.ttf";
    const LIBERATION_SANS = "LiberationSans-Regular.ttf";
    const LIBERATION_SANS_BOLD = "LiberationSans-Bold.ttf";
    const LIBERATION_SANS_ITALIC = "LiberationSans-Italic.ttf";
    const LIBERATION_SANS_BOLD_ITALIC = "LiberationSans-BoldItalic.ttf";
    const LUCIDA_CONSOLE = "lucon.ttf";
    const LUCIDA_SANS_UNICODE = "l_10646.ttf";
    const MICROSOFT_SANS_SERIF = "micross.ttf";
    const PALATINO_LINOTYPE = "pala.ttf";
    const PALATINO_LINOTYPE_BOLD = "palab.ttf";
    const PALATINO_LINOTYPE_ITALIC = "palai.ttf";
    const PALATINO_LINOTYPE_BOLD_ITALIC = "palabi.ttf";
    const SYMBOL = "symbol.ttf";
    const TAHOMA = "tahoma.ttf";
    const TAHOMA_BOLD = "tahomabd.ttf";
    const TIMES_NEW_ROMAN = "times.ttf";
    const TIMES_NEW_ROMAN_BOLD = "timesbd.ttf";
    const TIMES_NEW_ROMAN_ITALIC = "timesi.ttf";
    const TIMES_NEW_ROMAN_BOLD_ITALIC = "timesbi.ttf";
    const TREBUCHET_MS = "trebuc.ttf";
    const TREBUCHET_MS_BOLD = "trebucbd.ttf";
    const TREBUCHET_MS_ITALIC = "trebucit.ttf";
    const TREBUCHET_MS_BOLD_ITALIC = "trebucbi.ttf";
    const VERDANA = "verdana.ttf";
    const VERDANA_BOLD = "verdanab.ttf";
    const VERDANA_ITALIC = "verdanai.ttf";
    const VERDANA_BOLD_ITALIC = "verdanaz.ttf";
    public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
    {
        if(!in_array($pValue, self::$autoSizeMethods)) {
            return false;
        }
        self::$autoSizeMethod = $pValue;
        return true;
    }
    public static function getAutoSizeMethod()
    {
        return self::$autoSizeMethod;
    }
    public static function setTrueTypeFontPath($pValue = "")
    {
        self::$trueTypeFontPath = $pValue;
    }
    public static function getTrueTypeFontPath()
    {
        return self::$trueTypeFontPath;
    }
    public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = "", $rotation = 0, PHPExcel_Style_Font $defaultFont = NULL)
    {
        if($cellText instanceof PHPExcel_RichText) {
            $cellText = $cellText->getPlainText();
        }
        if(strpos($cellText, "\n") !== false) {
            $lineTexts = explode("\n", $cellText);
            $lineWidths = [];
            foreach ($lineTexts as $lineText) {
                $lineWidths[] = self::calculateColumnWidth($font, $lineText, $rotation = 0, $defaultFont);
            }
            return max($lineWidths);
        } else {
            $approximate = self::$autoSizeMethod == "approx";
            if(!$approximate) {
                $columnWidthAdjust = ceil(self::getTextWidthPixelsExact("n", $font, 0) * 0);
                try {
                    $columnWidth = self::getTextWidthPixelsExact($cellText, $font, $rotation) + $columnWidthAdjust;
                } catch (PHPExcel_Exception $e) {
                    $approximate = true;
                }
            }
            if($approximate) {
                $columnWidthAdjust = self::getTextWidthPixelsApprox("n", $font, 0);
                $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation) + $columnWidthAdjust;
            }
            $columnWidth = PHPExcel_Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont);
            return round($columnWidth, 6);
        }
    }
    public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
    {
        if(!function_exists("imagettfbbox")) {
            throw new PHPExcel_Exception("GD library needs to be enabled");
        }
        $fontFile = self::getTrueTypeFontFileFromFont($font);
        $textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text);
        list($lowerLeftCornerX, $lowerRightCornerX, $upperRightCornerX, $upperLeftCornerX) = $textBox;
        $textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
        return $textWidth;
    }
    public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = NULL, $rotation = 0)
    {
        $fontName = $font->getName();
        $fontSize = $font->getSize();
        switch ($fontName) {
            case "Calibri":
                $columnWidth = (int) (0 * PHPExcel_Shared_String::CountCharacters($columnText));
                $columnWidth = $columnWidth * $fontSize / 11;
                break;
            case "Arial":
                $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
                $columnWidth = $columnWidth * $fontSize / 10;
                break;
            case "Verdana":
                $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
                $columnWidth = $columnWidth * $fontSize / 10;
                break;
            default:
                $columnWidth = (int) (0 * PHPExcel_Shared_String::CountCharacters($columnText));
                $columnWidth = $columnWidth * $fontSize / 11;
                if($rotation !== 0) {
                    if($rotation == -165) {
                        $columnWidth = 4;
                    } else {
                        $columnWidth = $columnWidth * cos(deg2rad($rotation)) + $fontSize * abs(sin(deg2rad($rotation))) / 5;
                    }
                }
                return (int) $columnWidth;
        }
    }
    public static function fontSizeToPixels($fontSizeInPoints = 11)
    {
        return (int) (0 * $fontSizeInPoints);
    }
    public static function inchSizeToPixels($sizeInInch = 1)
    {
        return $sizeInInch * 96;
    }
    public static function centimeterSizeToPixels($sizeInCm = 1)
    {
        return $sizeInCm * 0;
    }
    public static function getTrueTypeFontFileFromFont($font)
    {
        if(!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
            throw new PHPExcel_Exception("Valid directory to TrueType Font files not specified");
        }
        $name = $font->getName();
        $bold = $font->getBold();
        $italic = $font->getItalic();
        switch ($name) {
            case "Arial":
                $fontFile = $bold ? $italic ? "arialbi.ttf" : "arialbd.ttf" : ($italic ? "ariali.ttf" : "arial.ttf");
                break;
            case "Calibri":
                $fontFile = $bold ? $italic ? "CALIBRIZ.TTF" : "CALIBRIB.TTF" : ($italic ? "CALIBRII.TTF" : "CALIBRI.TTF");
                break;
            case "Courier New":
                $fontFile = $bold ? $italic ? "courbi.ttf" : "courbd.ttf" : ($italic ? "couri.ttf" : "cour.ttf");
                break;
            case "Comic Sans MS":
                $fontFile = $bold ? "comicbd.ttf" : "comic.ttf";
                break;
            case "Georgia":
                $fontFile = $bold ? $italic ? "georgiaz.ttf" : "georgiab.ttf" : ($italic ? "georgiai.ttf" : "georgia.ttf");
                break;
            case "Impact":
                $fontFile = "impact.ttf";
                break;
            case "Liberation Sans":
                $fontFile = $bold ? $italic ? "LiberationSans-BoldItalic.ttf" : "LiberationSans-Bold.ttf" : ($italic ? "LiberationSans-Italic.ttf" : "LiberationSans-Regular.ttf");
                break;
            case "Lucida Console":
                $fontFile = "lucon.ttf";
                break;
            case "Lucida Sans Unicode":
                $fontFile = "l_10646.ttf";
                break;
            case "Microsoft Sans Serif":
                $fontFile = "micross.ttf";
                break;
            case "Palatino Linotype":
                $fontFile = $bold ? $italic ? "palabi.ttf" : "palab.ttf" : ($italic ? "palai.ttf" : "pala.ttf");
                break;
            case "Symbol":
                $fontFile = "symbol.ttf";
                break;
            case "Tahoma":
                $fontFile = $bold ? "tahomabd.ttf" : "tahoma.ttf";
                break;
            case "Times New Roman":
                $fontFile = $bold ? $italic ? "timesbi.ttf" : "timesbd.ttf" : ($italic ? "timesi.ttf" : "times.ttf");
                break;
            case "Trebuchet MS":
                $fontFile = $bold ? $italic ? "trebucbi.ttf" : "trebucbd.ttf" : ($italic ? "trebucit.ttf" : "trebuc.ttf");
                break;
            case "Verdana":
                $fontFile = $bold ? $italic ? "verdanaz.ttf" : "verdanab.ttf" : ($italic ? "verdanai.ttf" : "verdana.ttf");
                $fontFile = self::$trueTypeFontPath . $fontFile;
                if(!file_exists($fontFile)) {
                    throw new PHPExcel_Exception("TrueType Font file not found");
                }
                return $fontFile;
                break;
            default:
                throw new PHPExcel_Exception("Unknown font name \"" . $name . "\". Cannot map to TrueType font file");
        }
    }
    public static function getCharsetFromFontName($name)
    {
        switch ($name) {
            case "EucrosiaUPC":
                return 221;
                break;
            case "Wingdings":
                return 2;
                break;
            case "Wingdings 2":
                return 2;
                break;
            case "Wingdings 3":
                return 2;
                break;
            default:
                return 0;
        }
    }
    public static function getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels = false)
    {
        if(isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) {
            $columnWidth = $pPixels ? self::$defaultColumnWidths[$font->getName()][$font->getSize()]["px"] : self::$defaultColumnWidths[$font->getName()][$font->getSize()]["width"];
        } else {
            $columnWidth = $pPixels ? self::$defaultColumnWidths["Calibri"][11]["px"] : self::$defaultColumnWidths["Calibri"][11]["width"];
            $columnWidth = $columnWidth * $font->getSize() / 11;
            if($pPixels) {
                $columnWidth = (int) round($columnWidth);
            }
        }
        return $columnWidth;
    }
    public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
    {
        $font->getName();
        switch ($font->getName()) {
            case "Arial":
                $font->getSize();
                switch ($font->getSize()) {
                    case 10:
                        $rowHeight = 0;
                        break;
                    case 9:
                        $rowHeight = 12;
                        break;
                    case 8:
                        $rowHeight = 0;
                        break;
                    case 7:
                        $rowHeight = 9;
                        break;
                    case 6:
                    case 5:
                        $rowHeight = 0;
                        break;
                    case 4:
                        $rowHeight = 0;
                        break;
                    case 3:
                        $rowHeight = 6;
                        break;
                    case 2:
                    case 1:
                        $rowHeight = 0;
                        break;
                    default:
                        $rowHeight = 0 * $font->getSize() / 10;
                }
                break;
            case "Calibri":
                $font->getSize();
                switch ($font->getSize()) {
                    case 11:
                        $rowHeight = 15;
                        break;
                    case 10:
                        $rowHeight = 0;
                        break;
                    case 9:
                        $rowHeight = 12;
                        break;
                    case 8:
                        $rowHeight = 0;
                        break;
                    case 7:
                        $rowHeight = 9;
                        break;
                    case 6:
                    case 5:
                        $rowHeight = 0;
                        break;
                    case 4:
                        $rowHeight = 0;
                        break;
                    case 3:
                        $rowHeight = 0;
                        break;
                    case 2:
                    case 1:
                        $rowHeight = 0;
                        break;
                    default:
                        $rowHeight = 15 * $font->getSize() / 11;
                }
                break;
            case "Verdana":
                $font->getSize();
                switch ($font->getSize()) {
                    case 10:
                        $rowHeight = 0;
                        break;
                    case 9:
                        $rowHeight = 0;
                        break;
                    case 8:
                        $rowHeight = 0;
                        break;
                    case 7:
                        $rowHeight = 0;
                        break;
                    case 6:
                    case 5:
                        $rowHeight = 0;
                        break;
                    case 4:
                        $rowHeight = 0;
                        break;
                    case 3:
                        $rowHeight = 6;
                        break;
                    case 2:
                    case 1:
                        $rowHeight = 0;
                        break;
                    default:
                        $rowHeight = 0 * $font->getSize() / 10;
                }
                break;
            default:
                $rowHeight = 15 * $font->getSize() / 11;
                return $rowHeight;
        }
    }
}

?>